package com.icezzz.circle_paint;

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JPanel;

/**
 * Hello world!
 *
 */
public class Main {
    public static void main(String[] args) {
        System.out.println("Hello World!");
        String path = "C:\\Users\\Administrator\\Desktop\\image.png";
        JFrame frame = new MyFrame();
        JPanel jp = new JPanel();
        frame.add(jp);
        frame.setSize(1100, 1500);
        frame.setVisible(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        FileOutputStream output = null;
        try {
            output = new FileOutputStream(new File(path));
        } catch (FileNotFoundException e1) {
            e1.printStackTrace();
        }
        BufferedImage createImage = new BufferedImage(2000, 2000, BufferedImage.TYPE_INT_RGB);
        Graphics graphics = createImage.getGraphics();
        frame.paint(graphics);
        try {
            ImageIO.write(createImage, "png", output);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
